<?php
class ErrorController extends MyClass_Action {

	public function errorAction() {
		$errors = $this->_getParam ( 'error_handler' );
		
		switch ($errors->type) {
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER :
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION :
				
				// 404 error -- controller or action not found
				$this->getResponse ()->setHttpResponseCode ( 404 );
				$message = 'HTTP 404 Page not found';
				break;
			default :
				// application error 
				$this->getResponse ()->setHttpResponseCode ( 500 );
				$message = '500 Application error';
				break;
		}
		$requestlist=var_export($errors->request->getParams(), true);
		$this->smarty = Zend_Registry::get ( 'smarty' );
		$this->smarty->assign ( 'development', APPLICATION_ENV  );
		$this->smarty->assign ( 'exception', $errors->exception->getMessage()  );
		$this->smarty->assign ( 'trace', $errors->exception->getTraceAsString() );
		$this->smarty->assign ( 'request', $requestlist );
		$this->smarty->assign ( 'message', $message );
		$this->smarty->display ( 'error/error.tpl' );
	}
}